﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Ssb
{
    public class Cursor
        : Image
    {
        public Bubble Pointer;
        public Boolean inOnSomething { get; set; }

        public Cursor(Bubble pointer, Game game)
            : base(game, ((ContentManager)game.Services.GetService(typeof(ContentManager))).Load<Texture2D>("Menus\\Cursors\\GenCursor"), Vector2.Zero)
        {
            Pointer = pointer;
        }

        public override void Update(GameTime gameTime)
        {
            MouseState ms = Mouse.GetState();

            this.X = ms.X;
            this.Y = ms.Y;

            base.Update(gameTime);
        }

        public override void Draw(GameTime gt)
        {
            ((SpriteBatch)Game.Services.GetService(typeof(SpriteBatch))).Draw(base.texture, base.coords, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
        }

        public bool PointsToRectangle(Rectangle rect)
        {
            if (this.Pointer.Coords.X + this.X <= (rect.Width + rect.X) && this.Pointer.Coords.X + this.X >= rect.X && this.Pointer.Coords.Y + this.Y <= (rect.Y + rect.Height) && this.Pointer.Coords.Y + this.Y >= rect.Y)
                return true;
            else
                return false;
        }
    }
}
